<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>DiscontinuousGalerkin: TrianguleElement.f90 Source File</title>

<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />

<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { searchBox.OnSelectItem(0); });
</script>

</head>
<body>
<div id="top"><!-- do not remove this div! -->


<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  
  
  <td style="padding-left: 0.5em;">
   <div id="projectname">DiscontinuousGalerkin
   &#160;<span id="projectnumber">0.0.1</span>
   </div>
   <div id="projectbrief">Geração Acoplada de Discontinuous Galerkin</div>
  </td>
  
  
  
 </tr>
 </tbody>
</table>
</div>

<!-- Generated by Doxygen 1.7.5.1 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="annotated.html"><span>Data&#160;Types&#160;List</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
      <li><a href="globals.html"><span>File&#160;Members</span></a></li>
    </ul>
  </div>
<div class="header">
  <div class="headertitle">
<div class="title">TrianguleElement.f90</div>  </div>
</div>
<div class="contents">
<a href="_triangule_element_8f90.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a><a class="code" href="class_triangle_element_manipulation.html">00001</a> <span class="keyword">module</span> <a class="code" href="class_triangle_element_manipulation.html">TriangleElementManipulation</a>
<a name="l00002"></a>00002     use <span class="keywordflow">MatrixOperation</span>
<a name="l00003"></a>00003     use <span class="keywordflow">GaussianIntegration</span>
<a name="l00004"></a>00004     use <span class="keywordflow">VectorOperations</span>
<a name="l00005"></a>00005     <span class="keyword">implicit none</span>
<a name="l00006"></a>00006 
<a name="l00007"></a><a class="code" href="class_triangle_element_manipulation.html#aba2a110042aead238e29e2fac1f6a260">00007</a>     <span class="keywordtype">integer</span>, <span class="keywordtype">parameter</span> :: nNodes = 3
<a name="l00008"></a><a class="code" href="class_triangle_element_manipulation.html#a401f39bb84c345cd5d2bf20933bf13fc">00008</a>     <span class="keywordtype">integer</span>, <span class="keywordtype">parameter</span> :: probDim = 2 <span class="comment">!&lt; Problem Dimension | Plane Problem</span>
<a name="l00009"></a>00009 
<a name="l00010"></a><a class="code" href="class_triangle_element_manipulation.html#a0c825e3823c299744caf96bf1d4374e0">00010</a>     <span class="keywordtype">integer</span>, <span class="keywordtype">parameter</span> :: MatrixSize = nNodes * (probDim + 1) <span class="comment">!&lt; Heat Fluxes (each dimension) and Temperature problem</span>
<a name="l00011"></a><a class="code" href="class_triangle_element_manipulation.html#a34b4bd95bc147657022b75b2c048b7f8">00011</a>         <span class="keywordtype">integer</span>, <span class="keywordtype">parameter</span> :: XAxis = 1
<a name="l00012"></a><a class="code" href="class_triangle_element_manipulation.html#ae264321f9e1208f703601c23b996db78">00012</a>         <span class="keywordtype">integer</span>, <span class="keywordtype">parameter</span> :: YAxis = 2
<a name="l00013"></a>00013 
<a name="l00014"></a><a class="code" href="class_triangle_element_manipulation.html#a6cd8a24ae73b1c803c867b018335c805">00014</a>         <span class="keywordtype">integer</span>, <span class="keywordtype">parameter</span> :: HeatFluxX_Initial = 1 <span class="comment">!&lt; Keeping track of Degrees of Freedom index meaning</span>
<a name="l00015"></a><a class="code" href="class_triangle_element_manipulation.html#af8966bdce82d9c30732a9c32140e525b">00015</a>         <span class="keywordtype">integer</span>, <span class="keywordtype">parameter</span> :: HeatFluxX_Final   = HeatFluxX_Initial + nNodes - 1
<a name="l00016"></a><a class="code" href="class_triangle_element_manipulation.html#a4e46edc8a32c2ba1d60b05a232feff84">00016</a>         <span class="keywordtype">integer</span>, <span class="keywordtype">parameter</span> :: HeatFluxY_Initial = HeatFluxX_Final + 1
<a name="l00017"></a><a class="code" href="class_triangle_element_manipulation.html#a33d529a82b57957b55eb8a48727b8fe1">00017</a>         <span class="keywordtype">integer</span>, <span class="keywordtype">parameter</span> :: HeatFluxY_Final = HeatFluxY_Initial + nNodes - 1
<a name="l00018"></a><a class="code" href="class_triangle_element_manipulation.html#a57655d22ee86a3c16a3a462d7e8b7f83">00018</a>         <span class="keywordtype">integer</span>, <span class="keywordtype">parameter</span> :: Temperature_Initial = HeatFluxY_Final + 1
<a name="l00019"></a><a class="code" href="class_triangle_element_manipulation.html#aaadae2647bae223a85d64b5d15707e88">00019</a>         <span class="keywordtype">integer</span>, <span class="keywordtype">parameter</span> :: Temperature_Final = Temperature_Initial + nNodes -1
<a name="l00020"></a>00020 
<a name="l00021"></a><a class="code" href="class_triangle_element_manipulation.html#a0b89811f307e276a2adb75f9728b2c41">00021</a>         <span class="keywordtype">integer</span>, <span class="keywordtype">parameter</span> :: Dof_Values = 2
<a name="l00022"></a><a class="code" href="class_triangle_element_manipulation.html#ab2a2732722f2a44fc3f1abf0c74a9d53">00022</a>         <span class="keywordtype">integer</span>, <span class="keywordtype">parameter</span> :: Dof_Try = 1 <span class="comment">!&lt; Try values for the element DoF</span>
<a name="l00023"></a><a class="code" href="class_triangle_element_manipulation.html#a56e39a984dfa999d9aae6f83240a3bf1">00023</a>         <span class="keywordtype">integer</span>, <span class="keywordtype">parameter</span> :: Dof_Commit = 2 <span class="comment">!&lt; Commit values for the element DoF</span>
<a name="l00024"></a>00024 
<a name="l00031"></a><a class="code" href="struct_triangle_element_manipulation_1_1_triangle_element.html">00031</a>     <span class="keyword">type</span> <a class="code" href="struct_triangle_element_manipulation_1_1_triangle_element.html">TriangleElement</a>
<a name="l00032"></a>00032 <span class="comment">!// \todo (ronaldo#1#): Modificar Matrix, Dof, OuterVector, NeighbourReNumbering para allocatable e ajustá-los em SetNodesTriangularElement</span>
<a name="l00033"></a><a class="code" href="struct_triangle_element_manipulation_1_1_triangle_element.html#a4f86655513f292e701534f26aaa48f88">00033</a>         <span class="keywordtype">real(kind=8)</span>, <span class="keywordtype">dimension(:,:)</span>, <span class="keywordtype">allocatable</span> :: Matrix
<a name="l00034"></a><a class="code" href="struct_triangle_element_manipulation_1_1_triangle_element.html#adb39be2d733faecc99cd806ac0ea7e42">00034</a>         <span class="keywordtype">integer</span>, <span class="keywordtype">dimension(nNodes)</span>                        :: Nodes
<a name="l00035"></a><a class="code" href="struct_triangle_element_manipulation_1_1_triangle_element.html#ad8408d0ee0fceb105f7e3ea9def86d94">00035</a>         <span class="keywordtype">real(kind=8)</span>, <span class="keywordtype">dimension(:,:)</span>    :: DoF <span class="comment">!&lt; Degres-Of-Freedom are comprised for the Try and Commit Values</span>
<a name="l00036"></a><a class="code" href="struct_triangle_element_manipulation_1_1_triangle_element.html#a6cdd4dd1450b5e9da147696a8d665a39">00036</a>         <span class="keywordtype">real(kind=8)</span>, <span class="keywordtype">dimension(:,:)</span>           :: OuterVector <span class="comment">!&lt; Outer vector oposed to the vertex</span>
<a name="l00037"></a><a class="code" href="struct_triangle_element_manipulation_1_1_triangle_element.html#ab8983d78dafa2a6ede7d2f5ce8f03168">00037</a>         <span class="keywordtype">integer</span>, <span class="keywordtype">dimension(nNodes, nNodes)</span>                :: NeighbourReNumbering
<a name="l00038"></a><a class="code" href="struct_triangle_element_manipulation_1_1_triangle_element.html#a6f3aa4702061c4c02c41162059aee26f">00038</a>         <span class="keywordtype">real(kind=8)</span>                                                                      :: S <span class="comment">!&lt; Auxiliar Space variable used to make calculations faster</span>
<a name="l00039"></a>00039 <span class="keyword">    end type</span>
<a name="l00040"></a>00040 
<a name="l00041"></a>00041 <span class="keyword">contains</span>
<a name="l00042"></a>00042 
<a name="l00043"></a>00043 
<a name="l00049"></a><a class="code" href="class_triangle_element_manipulation.html#a4adc13ead0bf8abc7f18ad46f7bbf483">00049</a>         <span class="keywordtype">pure</span> <span class="keyword">function </span>SolutionErrorRange( this ) result (v)
<a name="l00050"></a>00050                 <span class="keyword">implicit none</span>
<a name="l00051"></a>00051                 <span class="keywordtype">type(TriangleElement)</span>, <span class="keywordtype">intent(in)</span> :: this
<a name="l00052"></a>00052                 <span class="keywordtype">real(kind=8)</span> :: v
<a name="l00053"></a>00053                 v = norm_infty(this%DoF(:,Dof_Commit)-this%DoF(:,Dof_Try))
<a name="l00054"></a>00054 <span class="keyword">        end function</span>
<a name="l00055"></a>00055 
<a name="l00061"></a><a class="code" href="class_triangle_element_manipulation.html#aa106639c5dfecac6346f53342be11ecc">00061</a>     <span class="keyword">subroutine </span>SetNodesTriangularElement( this, Node1, Node2, Node3)
<a name="l00062"></a>00062         <span class="keyword">implicit none</span>
<a name="l00063"></a>00063         <span class="keywordtype">type(TriangleElement)</span>, <span class="keywordtype">intent(out)</span> :: this
<a name="l00064"></a>00064         <span class="keywordtype">integer</span>, <span class="keywordtype">intent(in)</span> :: Node1
<a name="l00065"></a>00065         <span class="keywordtype">integer</span>, <span class="keywordtype">intent(in)</span> :: Node2
<a name="l00066"></a>00066         <span class="keywordtype">integer</span>, <span class="keywordtype">intent(in)</span> :: Node3
<a name="l00067"></a>00067 
<a name="l00068"></a>00068 
<a name="l00069"></a>00069                 <span class="keywordtype">integer</span> :: statReturn
<a name="l00070"></a>00070 
<a name="l00071"></a>00071         this%Nodes(1) = Nodes1
<a name="l00072"></a>00072         this%Nodes(2) = Nodes2
<a name="l00073"></a>00073         this%Nodes(3) = Nodes3
<a name="l00074"></a>00074 
<a name="l00075"></a>00075                 <span class="keyword">allocate</span>( this%Matrix(MatrixSize, MatrixSize+1), stat=statReturn )
<a name="l00076"></a>00076                 <span class="keyword">if</span> (statReturn /= 0) <span class="keyword">then</span>
<a name="l00077"></a>00077                         print *, <span class="stringliteral">&#39;Unable to allocate memory for Matrix on Triangle Element.&#39;</span>
<a name="l00078"></a>00078                         return
<a name="l00079"></a>00079                 <span class="keyword">end if</span>
<a name="l00080"></a>00080 
<a name="l00081"></a>00081         this%Matrix = 0.0d0
<a name="l00082"></a>00082 
<a name="l00083"></a>00083         <span class="keyword">allocate</span>( this%DoF(MatrixSize, Dof_Values), stat=statReturn )
<a name="l00084"></a>00084         <span class="keyword">if</span> (statReturn /= 0) <span class="keyword">then</span>
<a name="l00085"></a>00085                 print *,  <span class="stringliteral">&#39;Unable to allocate memory for Degrees of Freedom on Triangle Element.&#39;</span>
<a name="l00086"></a>00086                 return
<a name="l00087"></a>00087         <span class="keyword">end if</span>
<a name="l00088"></a>00088 
<a name="l00089"></a>00089         this%DoF = 0.0d0
<a name="l00090"></a>00090 
<a name="l00091"></a>00091                 <span class="keyword">allocate</span>( this%NeighbourReNumbering(nNodes, nNodes), stat=statReturn )
<a name="l00092"></a>00092                 <span class="keyword">if</span> (statReturn /= 0) <span class="keyword">then</span>
<a name="l00093"></a>00093                         print *, <span class="stringliteral">&#39;Unable to allocate memory for Neighbour Renumbering Matrix on Triangle Element.&#39;</span>
<a name="l00094"></a>00094                         return
<a name="l00095"></a>00095                 <span class="keyword">end if</span>
<a name="l00096"></a>00096 
<a name="l00097"></a>00097                 this%NeighbourReNumbering = 0
<a name="l00098"></a>00098 
<a name="l00099"></a>00099         <span class="keyword">allocate</span>( this%OuterVector(nNodes, probDim), stat=statReturn )
<a name="l00100"></a>00100         <span class="keyword">if</span> (statReturn /= 0) <span class="keyword">then</span>
<a name="l00101"></a>00101                 print *, <span class="stringliteral">&#39;Unable to allocate memory for Outer Vector on Triangle Element.&#39;</span>
<a name="l00102"></a>00102                 return
<a name="l00103"></a>00103         <span class="keyword">end if</span>
<a name="l00104"></a>00104 
<a name="l00105"></a>00105 <span class="keyword">    end subroutine</span>
<a name="l00106"></a>00106 
<a name="l00107"></a>00107 
<a name="l00108"></a>00108 
<a name="l00114"></a><a class="code" href="class_triangle_element_manipulation.html#a95afdc8652309cbfcb2761a27eedbdbc">00114</a>         <span class="keyword">subroutine </span>SetMatrixTriangleElement( this, X, ThermCond, Stabilization )
<a name="l00115"></a>00115         <span class="keyword">implicit none</span>
<a name="l00116"></a>00116         <span class="keywordtype">type(TriangleElement)</span>, <span class="keywordtype">intent(inout)</span> :: this
<a name="l00117"></a>00117         <span class="keywordtype">real(kind=8)</span>, <span class="keywordtype">dimension(nNodes, probDim)</span>, <span class="keywordtype">intent(in)</span> :: X
<a name="l00118"></a>00118         <span class="keyword">interface</span>
<a name="l00119"></a>00119                         <span class="keywordtype">pure</span> <span class="keyword">function </span>ThermCond(T) result (v) !&lt; Thermal Conductivity Function
<a name="l00120"></a>00120                                 <span class="keyword">implicit none</span>
<a name="l00121"></a>00121                                 <span class="keywordtype">real(kind=8)</span>, <span class="keywordtype">intent(in)</span> :: T
<a name="l00122"></a>00122                                 <span class="keywordtype">real(kind=8)</span> :: v
<a name="l00123"></a>00123 <span class="keyword">                        end function</span>
<a name="l00124"></a>00124 <span class="keyword">                end interface</span>
<a name="l00125"></a>00125                 <span class="keywordtype">real(kind=8)</span>, <span class="keywordtype">intent(in)</span> :: Stabilization
<a name="l00126"></a>00126 
<a name="l00127"></a>00127                 this % Matrix(1:MatrixSize,1:MatrixSize) = 0.0d0
<a name="l00128"></a>00128 
<a name="l00129"></a>00129         call SetMatricesE( this%Matrix(1:MatrixSize,1:MatrixSize), X )
<a name="l00130"></a>00130         call SetMatricesH_l( this, this%Matrix(1:MatrixSize,1:MatrixSize), X )
<a name="l00131"></a>00131         call SetMatricesJ_l( this, this%Matrix(1:MatrixSize,1:MatrixSize), X )
<a name="l00132"></a>00132 
<a name="l00133"></a>00133                 call SetMatricesE_lr_i( this, this%Matrix(1:MatrixSize,1:MatrixSize), X, ThermCond, Stabilizaiton )
<a name="l00134"></a>00134                 call SetMatricesH_l_i( this, this%Matrix(1:MatrixSize,1:MatrixSize), X, ThermCond, Stabilizaiton )
<a name="l00135"></a>00135                 call SetMatricesJ_l_i( this, this%Matrix(1:MatrixSize,1:MatrixSize), X, Stabilizaiton )
<a name="l00136"></a>00136                 call SetMatrixG_T_i( this%Matrix(1:MatrixSize,1:MatrixSize), X, Stabilizaiton )
<a name="l00137"></a>00137 <span class="keyword">    end subroutine</span>
<a name="l00138"></a>00138 
<a name="l00139"></a>00139 
<a name="l00140"></a><a class="code" href="class_triangle_element_manipulation.html#a2e7a4c7fb3ec32e4f4c9160026a56291">00140</a>         <span class="keyword">subroutine </span>SetVectorTriangleElement( this, X, Neighbours, ThermCond, Stabilization )
<a name="l00141"></a>00141         <span class="keyword">implicit none</span>
<a name="l00142"></a>00142         <span class="keywordtype">type(TriangleElement)</span>, <span class="keywordtype">intent(inout)</span> :: this
<a name="l00143"></a>00143         <span class="keywordtype">real(kind=8)</span>, <span class="keywordtype">dimension(nNodes, probDim)</span>, <span class="keywordtype">intent(in)</span> :: X
<a name="l00144"></a>00144         <span class="keywordtype">type(TriangleElement)</span>, <span class="keywordtype">dimension(nNodes)</span>, <span class="keywordtype">intent(in)</span> :: Neighbours
<a name="l00145"></a>00145         <span class="keyword">interface</span>
<a name="l00146"></a>00146                         <span class="keywordtype">pure</span> <span class="keyword">function </span>ThermCond(T) result (v) !&lt; Thermal Conductivity Function
<a name="l00147"></a>00147                                 <span class="keyword">implicit none</span>
<a name="l00148"></a>00148                                 <span class="keywordtype">real(kind=8)</span>, <span class="keywordtype">intent(in)</span> :: T
<a name="l00149"></a>00149                                 <span class="keywordtype">real(kind=8)</span> :: v
<a name="l00150"></a>00150 <span class="keyword">                        end function</span>
<a name="l00151"></a>00151 <span class="keyword">                end interface</span>
<a name="l00152"></a>00152                 <span class="keywordtype">real(kind=8)</span>, <span class="keywordtype">intent(in)</span> :: Stabilization
<a name="l00153"></a>00153 
<a name="l00154"></a>00154                 call SetMatricesE_lr_B_i(this, this%Matrix(:,MatrixSize+1), Neighbours, ThermCond, Stabilization )
<a name="l00155"></a>00155                 call SetMatricesH_l_B_i(this, this%Matrix(:,MatrixSize+1), Neighbours, Stabilization, ThermCond )
<a name="l00156"></a>00156                 call SetMatricesJ_l_B_i(this, this%Matrix(:,MatrixSize+1), Neighbours, Stabilization )
<a name="l00157"></a>00157 <span class="keyword">        end subroutine</span>
<a name="l00158"></a>00158 
<a name="l00159"></a><a class="code" href="class_triangle_element_manipulation.html#aea4c4dc8ae606e03f08045ca68c498b9">00159</a>         <span class="keyword">subroutine </span>SetAllNeighboursNumbering(this, Neighbours)
<a name="l00160"></a>00160                 <span class="keyword">implicit none</span>
<a name="l00161"></a>00161                 <span class="keywordtype">type(TriangularElement)</span>, <span class="keywordtype">intent(inout)</span> :: this
<a name="l00162"></a>00162                 <span class="keywordtype">type(TriangularElement)</span>, <span class="keywordtype">dimension(nNodes)</span>, <span class="keywordtype">intent(in)</span> :: Neighbours
<a name="l00163"></a>00163 
<a name="l00164"></a>00164                 <span class="keywordtype">integer</span>, <span class="keywordtype">intent(in)</span> :: i
<a name="l00165"></a>00165 
<a name="l00166"></a>00166                 <span class="keyword">do</span> i = 1, nNodes
<a name="l00167"></a>00167                         call SetNeighbourNumbering(this, i, Neighbours(i))
<a name="l00168"></a>00168                 <span class="keyword">end do</span>
<a name="l00169"></a>00169 <span class="keyword">        end subroutine</span>
<a name="l00170"></a>00170 
<a name="l00171"></a>00171 
<a name="l00172"></a><a class="code" href="class_triangle_element_manipulation.html#ada21f9c637fff1fb8ee30adf71a51bdf">00172</a>         <span class="keyword">subroutine </span>SetNeighbourNumbering(this, i, Neighbour)
<a name="l00173"></a>00173                 <span class="keyword">implicit none</span>
<a name="l00174"></a>00174                 <span class="keywordtype">type(TriangularElement)</span>, <span class="keywordtype">intent(inout)</span> :: this
<a name="l00175"></a>00175                 <span class="keywordtype">integer</span>, <span class="keywordtype">intent(in)</span> :: i
<a name="l00176"></a>00176                 <span class="keywordtype">type(TriangularElement)</span>, <span class="keywordtype">intent(in)</span> :: Neighbour
<a name="l00177"></a>00177 
<a name="l00178"></a>00178                 call <a class="code" href="_triangule_element_8f90.html#aa65599e532bc8e6f4103641ed1d795c0">buildPermutation </a>(i)
<a name="l00179"></a>00179         <span class="keyword">contains</span>
<a name="l00180"></a><a class="code" href="_triangule_element_8f90.html#a68bec4143b8531cb525eb378d9de4260">00180</a>                 <span class="keywordtype">pure</span> <span class="keyword">function </span><a class="code" href="_triangule_element_8f90.html#a68bec4143b8531cb525eb378d9de4260">findNode</a>(n) return (NbIdx)
<a name="l00181"></a>00181                         <span class="keyword">implicit none</span>
<a name="l00182"></a>00182                         <span class="keywordtype">integer</span>, <span class="keywordtype">intent(in)</span> :: n
<a name="l00183"></a>00183                         <span class="keywordtype">integer</span> :: NbIdx
<a name="l00184"></a>00184                         <span class="keywordtype">integer</span> :: k
<a name="l00185"></a>00185                         <span class="keyword">do</span> k = 1, nNodes
<a name="l00186"></a>00186                                 <span class="keyword">if</span> (Neighbour%nodes(k) == this%Nodes(n)) <span class="keyword">then</span>
<a name="l00187"></a>00187                                         NbIdx = k
<a name="l00188"></a>00188                                         return
<a name="l00189"></a>00189                                 <span class="keyword">end if</span>
<a name="l00190"></a>00190                         <span class="keyword">end do</span>
<a name="l00191"></a>00191                         NbIdx = 0
<a name="l00192"></a>00192 <span class="keyword">                end function</span>
<a name="l00193"></a><a class="code" href="_triangule_element_8f90.html#aa65599e532bc8e6f4103641ed1d795c0">00193</a>                 <span class="keyword">subroutine </span><a class="code" href="_triangule_element_8f90.html#aa65599e532bc8e6f4103641ed1d795c0">buildPermutation</a>( n )
<a name="l00194"></a>00194                         <span class="keyword">implicit none</span>
<a name="l00195"></a>00195                         <span class="keywordtype">integer</span>, <span class="keywordtype">intent(in)</span> :: n
<a name="l00196"></a>00196                         <span class="keywordtype">integer</span> :: k, f
<a name="l00197"></a>00197                         <span class="keyword">do</span> k = 1, nNodes
<a name="l00198"></a>00198                                 f = <a class="code" href="_triangule_element_8f90.html#a68bec4143b8531cb525eb378d9de4260">findNode</a>(k)
<a name="l00199"></a>00199                                 <span class="keyword">if</span> (f == 0) <span class="keyword">then</span>
<a name="l00200"></a>00200                                         this%NeighbourReNumbering(n,k) = k
<a name="l00201"></a>00201                                 <span class="keyword">else</span>
<a name="l00202"></a>00202                                         this%NeighbourReNumbering(n,<a class="code" href="_triangule_element_8f90.html#a68bec4143b8531cb525eb378d9de4260">findNode</a>(k)) = k
<a name="l00203"></a>00203                                 <span class="keyword">end if</span>
<a name="l00204"></a>00204                         <span class="keyword">end do</span>
<a name="l00205"></a>00205 <span class="keyword">                end subroutine</span>
<a name="l00206"></a>00206 <span class="keyword">        end subroutine</span>
<a name="l00207"></a>00207 
<a name="l00208"></a><a class="code" href="class_triangle_element_manipulation.html#a7ccb0c13110096431d8d245525bd292c">00208</a>         <span class="keywordtype">pure</span> <span class="keyword">function </span>VectorRenumber( this, i ) result (Indexes)
<a name="l00209"></a>00209                 <span class="keyword">implicit none</span>
<a name="l00210"></a>00210                 <span class="keywordtype">type(
                integer, intent(in) :: i
                integer, dimension(MatrixSize) :: Indexes

                integer :: k
                do k = 1, nNodes
                        Indexes(HeatFluxX_Initial+k-1) = HeatFluxX_Initial+this%NeighbourReNumbering(i, k)-1
                        Indexes(HeatFluxY_Initial+k-1) = HeatFluxY_Initial+this%NeighbourReNumbering(i, k)-1
                        Indexes(Temperature_Initial+k-1) = Temperature_Initial+this%NeighbourReNumbering(i, k)-1
                end do
        end function

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!Calculations Zone Delimiter!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!


        !&gt; \brief Calculate the rotation of nodes over a Triangle
        !!
        !! \param n - the edge oposed to vertex n which is going to be calculated the normal vector
        !! \return v - 3-d integer vector with the local indexes of the Nodes
        !!
        pure function rotation(n) result (v)
                implicit none
                integer, intent(in) :: n
                integer, dimension(3) :: v
                select case(n)
                        case(1)
                                v(1) = 1
                                v(2) = 2
                                v(3) = 3
                        case(2)
                                v(1) = 2
                                v(2) = 3
                                v(3) = 1
                        case(3)
                                v(1) = 3
                                v(2) = 1
                                v(3) = 2
                        case default
                                v(1) = 1
                                v(2) = 2
                                v(3) = 3
                end select
        end function


    !&gt; \brief Calculate the outer normal vector oposed to de vertex i
    !!  the calculations are preformed using a extension of the problem dimension to generate a orthogonal vector by cross vector product.
    !! \param this - Triangular Element
    !! \param Coordinates - The Coordinates Position of the Nodes
    !!
    subroutine CalculateOuterVector(this, Coordinates)
        implicit none
        type(TriangleElement), intent(out) :: this
        real(kind=8), dimension(nNodes,probDim) :: Coordinates

                real(kind=8), dimension(2) :: Xm
                real(kind=8), dimension(3) :: V1, V2

                call CalculateOverSide(1)
                call CalculateOverSide(2)
                call CalculateOverSide(3)

        contains
                subroutine CalculateOverSide(n)
                        implicit none
                        integer, intent(in) :: n

                        integer, dimension(3) :: p

                        p = rotation(n)

                        !&lt; Xvirt = Xm(extended); Xm(3) = 1.0d0
                        !&lt; The projection of Xvirt on the plane is already over the the edge defined by Xp(2) and Xp(3)
                        Xm = (Coordinates(p(2),:)</span> + Coordinates(p(3),:))/2.0d0
<a name="l00211"></a>00211                         V1(1:2) = Xm-Coordinates(p(2),:) <span class="comment">!&lt; V1 = XVirt-X2</span>
<a name="l00212"></a>00212                         V1(3) = 1.0d0
<a name="l00213"></a>00213 
<a name="l00214"></a>00214                         V2(1:2) = Coordinates(p(3),:)-Coordinates(p(2),:) <span class="comment">!&lt; V2 = X3-X2</span>
<a name="l00215"></a>00215                         V2(3) = 0.0d0
<a name="l00216"></a>00216 
<a name="l00217"></a>00217                         <span class="comment">!&lt; This is already a normal vector</span>
<a name="l00218"></a>00218                         V1 = Cross(V1, V2) <span class="comment">!&lt; Cross vector product is not assumed to have the vectors V1 and V2 well positioned</span>
<a name="l00219"></a>00219 
<a name="l00220"></a>00220                         Xm = Xm - Coordinates(p(1),:) <span class="comment">!&lt; Outer vector of edge oposed to vertex 1</span>
<a name="l00221"></a>00221                         <span class="keyword">if</span> (dot_product(Xm,V1(1:2))&gt;0) <span class="keyword">then</span>
<a name="l00222"></a>00222                                 this%OuterVector(p(1),:) = V1(1:2)
<a name="l00223"></a>00223                         <span class="keyword">else</span>
<a name="l00224"></a>00224                                 this%OuterVector(p(1),:) = -V1(1:2)
<a name="l00225"></a>00225                         <span class="keyword">end if</span>
<a name="l00226"></a>00226                         call Normalize(this%OuterVector(p(1),:))
<a name="l00227"></a>00227 <span class="keyword">                end subroutine</span>
<a name="l00228"></a>00228 <span class="keyword">    end subroutine</span>
<a name="l00229"></a>00229 
<a name="l00230"></a>00230 
<a name="l00231"></a>00231 
<a name="l00232"></a>00232 <span class="comment">!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!</span>
<a name="l00233"></a>00233 <span class="comment">!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!Common Use on the manipulation of TriangularElements!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!</span>
<a name="l00234"></a>00234 <span class="comment">!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!</span>
<a name="l00235"></a>00235 
<a name="l00236"></a>00236 
<a name="l00243"></a><a class="code" href="class_triangle_element_manipulation.html#a136c5300b34d7e30bd3447d93db41568">00243</a>     <span class="keywordtype">pure</span> <span class="keyword">function </span>TriangularPhi(i, eta ) result (v)
<a name="l00244"></a>00244         <span class="keyword">implicit none</span>
<a name="l00245"></a>00245         <span class="keywordtype">integer</span>, <span class="keywordtype">intent(in)</span> :: i
<a name="l00246"></a>00246         <span class="keywordtype">real(kind=8)</span>, <span class="keywordtype">dimension(3)</span>, <span class="keywordtype">intent(in)</span> :: eta
<a name="l00247"></a>00247         <span class="keywordtype">real(kind=8)</span> :: v
<a name="l00248"></a>00248                 <span class="keyword">if</span>(<span class="keyword">size</span>(eta) /= 3 ) return
<a name="l00249"></a>00249         <span class="keyword">select</span> <span class="keyword">case</span>(i)
<a name="l00250"></a>00250             <span class="keyword">case</span>(1)
<a name="l00251"></a>00251                 v = eta(1)
<a name="l00252"></a>00252             <span class="keyword">case</span>(2)
<a name="l00253"></a>00253                 v = eta(2)
<a name="l00254"></a>00254             <span class="keyword">case</span>(3)
<a name="l00255"></a>00255                 v = eta(3)
<a name="l00256"></a>00256             <span class="keyword">case</span> default
<a name="l00257"></a>00257                 v = 0.0d0
<a name="l00258"></a>00258         <span class="keyword">end select</span>
<a name="l00259"></a>00259 <span class="keyword">    end function</span>
<a name="l00260"></a>00260 
<a name="l00261"></a>00261 
<a name="l00268"></a><a class="code" href="class_triangle_element_manipulation.html#a1e29b98dc1fea11e901dff6a4e7594c7">00268</a>     <span class="keywordtype">pure</span> <span class="keyword">function </span>LinearPhi(i, eta) result (v)
<a name="l00269"></a>00269         <span class="keyword">implicit none</span>
<a name="l00270"></a>00270         <span class="keywordtype">integer</span>, <span class="keywordtype">intent(in)</span> :: i
<a name="l00271"></a>00271         <span class="keywordtype">real(kind=8)</span>, <span class="keywordtype">intent(in)</span> :: eta
<a name="l00272"></a>00272         <span class="keywordtype">real(kind=8)</span> :: v
<a name="l00273"></a>00273 
<a name="l00274"></a>00274         <span class="keyword">select</span> <span class="keyword">case</span>(i)
<a name="l00275"></a>00275             <span class="keyword">case</span>(1)
<a name="l00276"></a>00276                 v = 0.5d0 * (1.0d0 - eta)
<a name="l00277"></a>00277             <span class="keyword">case</span>(2)
<a name="l00278"></a>00278                 v = 0.5d0 * (1.0d0 + eta)
<a name="l00279"></a>00279             <span class="keyword">case</span> default
<a name="l00280"></a>00280                 v = 0.0d0
<a name="l00281"></a>00281         <span class="keyword">end select</span>
<a name="l00282"></a>00282 <span class="keyword">    end function</span>
<a name="l00283"></a>00283 
<a name="l00290"></a><a class="code" href="class_triangle_element_manipulation.html#af1b5756d5682c4682031ec74887ad4cd">00290</a>     <span class="keywordtype">pure</span> <span class="keyword">function </span>JacobianLength(X, indexes) result (v)
<a name="l00291"></a>00291                 <span class="keyword">implicit none</span>
<a name="l00292"></a>00292         <span class="keywordtype">real(kind=8)</span>, <span class="keywordtype">dimension(nNodes,probDim)</span>, <span class="keywordtype">intent(in)</span> :: X
<a name="l00293"></a>00293         <span class="keywordtype">integer</span>, <span class="keywordtype">dimension(3)</span>, <span class="keywordtype">intent(in)</span> :: indexes
<a name="l00294"></a>00294         <span class="keywordtype">real(kind=8)</span> :: v
<a name="l00295"></a>00295         v = 0.5d0*( (X(indexes(3),1) - X(indexes(2),1)**2.0d0 + (X(indexes(3),2) - X(indexes(2),2)**2.0d0)**0.5d0
<a name="l00296"></a>00296 <span class="keyword">    end function</span>
<a name="l00297"></a>00297 
<a name="l00298"></a>00298 
<a name="l00306"></a><a class="code" href="class_triangle_element_manipulation.html#ac185ecc4fe338d47d0cf88162bc6616d">00306</a>         <span class="keywordtype">pure</span> <span class="keyword">function </span>MatrixH_l( this, X, orientation ) result (local)
<a name="l00307"></a>00307                 <span class="keyword">implicit none</span>
<a name="l00308"></a>00308                 <span class="keywordtype">type(TriangleElement)</span>, <span class="keywordtype">intent(in)</span> :: this
<a name="l00309"></a>00309                 <span class="keywordtype">real(kind=8)</span>, <span class="keywordtype">dimension(nNodes,probDim)</span>, <span class="keywordtype">intent(in)</span> :: X
<a name="l00310"></a>00310                 <span class="keywordtype">integer</span>, <span class="keywordtype">intent(in)</span> :: orientation
<a name="l00311"></a>00311 
<a name="l00312"></a>00312                 <span class="keywordtype">real(kind=8)</span>, <span class="keywordtype">dimension(nNodes,nNodes)</span> :: local
<a name="l00313"></a>00313 <span class="comment">!// \todo (ronaldo#1#): É Necessario adequar para a condutividade térmica em função da temperatura.</span>
<a name="l00314"></a>00314 
<a name="l00315"></a>00315                 <span class="keyword">select</span> <span class="keyword">case</span>(orientation)
<a name="l00316"></a>00316                         <span class="keyword">case</span>(XAxis)
<a name="l00317"></a>00317                                 local (1,1) = X(2,2) - X(3,2) <span class="comment">!&lt; $y_{23}$</span>
<a name="l00318"></a>00318                                 local (1,2) = local(1,1)
<a name="l00319"></a>00319                                 local (1,3) = local(1,1)
<a name="l00320"></a>00320                                 local (2,1) = X(3,2) - X(1,2) <span class="comment">!&lt; $y_{31}$</span>
<a name="l00321"></a>00321                                 local (2,2) = local(2,1)
<a name="l00322"></a>00322                                 local (2,3) = local(2,1)
<a name="l00323"></a>00323                                 local (3,1) = X(1,2) - X(2,2) <span class="comment">!&lt; $y_{12}$</span>
<a name="l00324"></a>00324                                 local (3,2) = local(3,1)
<a name="l00325"></a>00325                                 local (3,3) = local(3,1)
<a name="l00326"></a>00326                         <span class="keyword">case</span>(YAxis)
<a name="l00327"></a>00327                                 local (1,1) = X(3,1) - X(2,1) <span class="comment">!&lt; $x_{32}$</span>
<a name="l00328"></a>00328                                 local (1,2) = local(1,1)
<a name="l00329"></a>00329                                 local (1,3) = local(1,1)
<a name="l00330"></a>00330                                 local (2,1) = X(1,1) - X(3,1) <span class="comment">!&lt; $x_{13}$</span>
<a name="l00331"></a>00331                                 local (2,2) = local(2,1)
<a name="l00332"></a>00332                                 local (2,3) = local(2,1)
<a name="l00333"></a>00333                                 local (3,1) = X(2,1) - X(1,1) <span class="comment">!&lt; $x_{21}$</span>
<a name="l00334"></a>00334                                 local (3,2) = local(3,1)
<a name="l00335"></a>00335                                 local (3,3) = local(3,1)
<a name="l00336"></a>00336                         <span class="keyword">case</span> default
<a name="l00337"></a>00337                                 local (1,1) = X(2,2) - X(3,2) <span class="comment">!&lt; $y_{23}$</span>
<a name="l00338"></a>00338                                 local (1,2) = local(1,1)
<a name="l00339"></a>00339                                 local (1,3) = local(1,1)
<a name="l00340"></a>00340                                 local (2,1) = X(3,2) - X(1,2) <span class="comment">!&lt; $y_{31}$</span>
<a name="l00341"></a>00341                                 local (2,2) = local(2,1)
<a name="l00342"></a>00342                                 local (2,3) = local(2,1)
<a name="l00343"></a>00343                                 local (3,1) = X(1,2) - X(2,2) <span class="comment">!&lt; $y_{12}$</span>
<a name="l00344"></a>00344                                 local (3,2) = local(3,1)
<a name="l00345"></a>00345                                 local (3,3) = local(3,1)
<a name="l00346"></a>00346 
<a name="l00347"></a>00347                 <span class="keyword">end select</span>
<a name="l00348"></a>00348                 local = local/6.0d0
<a name="l00349"></a>00349 <span class="keyword">        end function</span>
<a name="l00350"></a>00350 
<a name="l00351"></a>00351 
<a name="l00363"></a><a class="code" href="class_triangle_element_manipulation.html#a59d626ac2b4f31b137b8769174c2fda7">00363</a>         <span class="keywordtype">pure</span> <span class="keyword">function </span>MatrixE_lr_i_km( this, l, r, i, k, m, X, ThermCond ) result (cell)
<a name="l00364"></a>00364         <span class="keyword">implicit none</span>
<a name="l00365"></a>00365                 <span class="keywordtype">integer</span>, <span class="keywordtype">parameter</span> :: nInterpolationPoints = 3
<a name="l00366"></a>00366                 <span class="keywordtype">integer</span>, <span class="keywordtype">parameter</span> :: nDimension = 2
<a name="l00367"></a>00367         <span class="keywordtype">integer</span>, <span class="keywordtype">parameter</span> :: IntPoints = 1
<a name="l00368"></a>00368         <span class="keywordtype">integer</span>, <span class="keywordtype">parameter</span> :: nSides = 3
<a name="l00369"></a>00369         <span class="keywordtype">type(TriangleElement)</span>, <span class="keywordtype">intent(in)</span> :: this
<a name="l00370"></a>00370                 <span class="keywordtype">integer</span>, <span class="keywordtype">intent(in)</span> :: l, r, i, k, m
<a name="l00371"></a>00371         <span class="keywordtype">real(kind=8)</span>, <span class="keywordtype">dimension(nNodes,2)</span>, <span class="keywordtype">intent(in)</span> :: X <span class="comment">!&lt; Planar Element</span>
<a name="l00372"></a>00372         <span class="keyword">interface</span>
<a name="l00373"></a>00373                         <span class="keywordtype">pure</span> <span class="keyword">function </span>ThermCond(T) result (v) !&lt; Thermal Conductivity Function
<a name="l00374"></a>00374                                 <span class="keyword">implicit none</span>
<a name="l00375"></a>00375                                 <span class="keywordtype">real(kind=8)</span>, <span class="keywordtype">intent(in)</span> :: T
<a name="l00376"></a>00376                                 <span class="keywordtype">real(kind=8)</span> :: v
<a name="l00377"></a>00377 <span class="keyword">                        end function</span>
<a name="l00378"></a>00378 <span class="keyword">                end interface</span>
<a name="l00379"></a>00379 
<a name="l00380"></a>00380         <span class="keywordtype">real(kind=8)</span> :: cell
<a name="l00381"></a>00381                 <span class="keywordtype">integer</span> :: g <span class="comment">!&lt; integration points index</span>
<a name="l00382"></a>00382                 <span class="keywordtype">integer</span> :: a <span class="comment">!&lt; Thermal Conductivity interpolation Index</span>
<a name="l00383"></a>00383 
<a name="l00384"></a>00384                 <span class="keywordtype">real(kind=8)</span>, <span class="keywordtype">dimension(IntPoints)</span> :: IntegrationPoints
<a name="l00385"></a>00385                 <span class="keywordtype">real(kind=8)</span>, <span class="keywordtype">dimension(IntPoints)</span> :: IntegrationWeights
<a name="l00386"></a>00386 
<a name="l00387"></a>00387                 <span class="keywordtype">integer</span>, <span class="keywordtype">dimension(3)</span> :: vertex
<a name="l00388"></a>00388 
<a name="l00389"></a>00389                 IntegrationPoints = LinearIntegrationPoints(IntPoints)
<a name="l00390"></a>00390                 IntegrationWeights = LinearIntegrationWeights(IntPoints)
<a name="l00391"></a>00391 
<a name="l00392"></a>00392                 cell = 0.0d0
<a name="l00393"></a>00393                 vertex = rotation(i)
<a name="l00394"></a>00394                 forall (a=2:3) <span class="comment">!&lt; Points not regarding the vertex pivoting the situation</span>
<a name="l00395"></a>00395                         forall (g=1:IntPoints) <span class="comment">!&lt; Warp through Integration Points</span>
<a name="l00396"></a>00396                                 cell = cell + ThermCond(this%DOF(Temperature_Initial+a-1))*&amp;
<a name="l00397"></a>00397                                                         LinearPhi(vertex(a), IntegrationPoints(g)) *&amp;
<a name="l00398"></a>00398                                                         LinearPhi(k, IntegrationPoints(g)) *&amp;
<a name="l00399"></a>00399                                                         LinearPhi(m, IntegrationPoints(g)) *&amp;
<a name="l00400"></a>00400                                                         IntegrationWeights(g)
<a name="l00401"></a>00401                         <span class="keyword">end</span> forall
<a name="l00402"></a>00402                 <span class="keyword">end</span> forall
<a name="l00403"></a>00403                 cell = this%OuterVector(i,l) * this%OuterVector(i,r) * JacobianLength(X, vertex) * Stabilization * cell
<a name="l00404"></a>00404 <span class="keyword">        end function</span>
<a name="l00405"></a>00405 
<a name="l00406"></a>00406 
<a name="l00418"></a><a class="code" href="class_triangle_element_manipulation.html#a4e5a644bc9dd3b445a5a70933462009f">00418</a>         <span class="keywordtype">pure</span> <span class="keyword">function </span>MatrixH_l_i_km( this, l, i, k, m, X, ThermCond ) result (cell)
<a name="l00419"></a>00419         <span class="keyword">implicit none</span>
<a name="l00420"></a>00420                 <span class="keywordtype">integer</span>, <span class="keywordtype">parameter</span> :: nInterpolationPoints = nNodes
<a name="l00421"></a>00421                 <span class="keywordtype">integer</span>, <span class="keywordtype">parameter</span> :: nDimension = probDim
<a name="l00422"></a>00422         <span class="keywordtype">integer</span>, <span class="keywordtype">parameter</span> :: IntPoints = 1
<a name="l00423"></a>00423         <span class="keywordtype">type(TriangleElement)</span>, <span class="keywordtype">intent(in)</span> :: this
<a name="l00424"></a>00424                 <span class="keywordtype">integer</span>, <span class="keywordtype">intent(in)</span> :: l, i, k, m
<a name="l00425"></a>00425         <span class="keywordtype">real(kind=8)</span>, <span class="keywordtype">dimension(nNodes,2)</span>, <span class="keywordtype">intent(in)</span> :: X <span class="comment">!&lt; Planar Element</span>
<a name="l00426"></a>00426         <span class="keyword">interface</span>
<a name="l00427"></a>00427                         <span class="keywordtype">pure</span> <span class="keyword">function </span>ThermCond(T) result (v) !&lt; Thermal Conductivity Function
<a name="l00428"></a>00428                                 <span class="keyword">implicit none</span>
<a name="l00429"></a>00429                                 <span class="keywordtype">real(kind=8)</span>, <span class="keywordtype">intent(in)</span> :: T
<a name="l00430"></a>00430                                 <span class="keywordtype">real(kind=8)</span> :: v
<a name="l00431"></a>00431 <span class="keyword">                        end function</span>
<a name="l00432"></a>00432 <span class="keyword">                end interface</span>
<a name="l00433"></a>00433 
<a name="l00434"></a>00434         <span class="keywordtype">real(kind=8)</span> :: cell
<a name="l00435"></a>00435                 <span class="keywordtype">integer</span> :: g <span class="comment">!&lt; integration points index</span>
<a name="l00436"></a>00436                 <span class="keywordtype">integer</span> :: a <span class="comment">!&lt; Thermal Conductivity interpolation Index</span>
<a name="l00437"></a>00437 
<a name="l00438"></a>00438                 <span class="keywordtype">real(kind=8)</span>, <span class="keywordtype">dimension(IntPoints,3)</span> :: IntegrationPoints
<a name="l00439"></a>00439                 <span class="keywordtype">real(kind=8)</span>, <span class="keywordtype">dimension(IntPoints)</span> :: IntegrationWeights
<a name="l00440"></a>00440 
<a name="l00441"></a>00441                 IntegrationPoints = LinearIntegrationPoints(IntPoints)
<a name="l00442"></a>00442                 IntegrationWeights = LinearIntegrationWeights(IntPoints)
<a name="l00443"></a>00443 
<a name="l00444"></a>00444                 cell = 0.0d0
<a name="l00445"></a>00445                 vertex = rotation(i)
<a name="l00446"></a>00446                 forall (a=2:3) <span class="comment">!&lt; Points not regarding the vertex pivoting the situation</span>
<a name="l00447"></a>00447                         forall (g=1:IntPoints) <span class="comment">!&lt; Warp through Integration Points</span>
<a name="l00448"></a>00448                                 cell = cell + ThermCond(this%DOF(Temperature_Initial+a-1))*&amp;
<a name="l00449"></a>00449                                                         LinearPhi(vertex(a), IntegrationPoints(g)) *&amp;
<a name="l00450"></a>00450                                                         LinearPhi(k, IntegrationPoints(g)) *&amp;
<a name="l00451"></a>00451                                                         LinearPhi(m, IntegrationPoints(g)) *&amp;
<a name="l00452"></a>00452                                                         IntegrationWeights(g)
<a name="l00453"></a>00453                         <span class="keyword">end</span> forall
<a name="l00454"></a>00454                 <span class="keyword">end</span> forall
<a name="l00455"></a>00455                 cell = cell  * JacobianLength(X, vertex) * this%OuterVector(i,l)
<a name="l00456"></a>00456 <span class="keyword">        end function</span>
<a name="l00457"></a>00457 
<a name="l00458"></a>00458 
<a name="l00469"></a><a class="code" href="class_triangle_element_manipulation.html#a0575602dd755d5921440ad74164e9580">00469</a>         <span class="keyword">function </span>MatrixJ_l_i_km( this, l, i, k, m, X ) result (cell)
<a name="l00470"></a>00470         <span class="keyword">implicit none</span>
<a name="l00471"></a>00471                 <span class="keywordtype">integer</span>, <span class="keywordtype">parameter</span> :: nInterpolationPoints = 3
<a name="l00472"></a>00472                 <span class="keywordtype">integer</span>, <span class="keywordtype">parameter</span> :: nDimension = 2
<a name="l00473"></a>00473         <span class="keywordtype">integer</span>, <span class="keywordtype">parameter</span> :: IntPoints = 1
<a name="l00474"></a>00474         <span class="keywordtype">type(TriangleElement)</span>, <span class="keywordtype">intent(inout)</span> :: this
<a name="l00475"></a>00475                 <span class="keywordtype">integer</span>, <span class="keywordtype">intent(in)</span> :: l, i, k, m
<a name="l00476"></a>00476         <span class="keywordtype">real(kind=8)</span>, <span class="keywordtype">dimension(nNodes,2)</span>, <span class="keywordtype">intent(in)</span> :: X <span class="comment">!&lt; Planar Element</span>
<a name="l00477"></a>00477 
<a name="l00478"></a>00478         <span class="keywordtype">real(kind=8)</span> :: cell
<a name="l00479"></a>00479                 <span class="keywordtype">integer</span> :: g <span class="comment">!&lt; integration points index</span>
<a name="l00480"></a>00480 
<a name="l00481"></a>00481                 <span class="keywordtype">real(kind=8)</span>, <span class="keywordtype">dimension(IntPoints)</span> :: IntegrationPoints
<a name="l00482"></a>00482                 <span class="keywordtype">real(kind=8)</span>, <span class="keywordtype">dimension(IntPoints)</span> :: IntegrationWeights
<a name="l00483"></a>00483 
<a name="l00484"></a>00484                 <span class="keywordtype">integer</span>, <span class="keywordtype">dimension(3)</span> :: vertex
<a name="l00485"></a>00485 
<a name="l00486"></a>00486                 IntegrationPoints = LinearIntegrationPoints(IntPoints)
<a name="l00487"></a>00487                 IntegrationWeights = LinearIntegrationWeights(IntPoints)
<a name="l00488"></a>00488 
<a name="l00489"></a>00489                 cell = 0.0d0
<a name="l00490"></a>00490                 vertex = rotation(i)
<a name="l00491"></a>00491                 forall (g=1:IntPoints) <span class="comment">!&lt; Warp through Integration Points</span>
<a name="l00492"></a>00492                         cell = cell + LinearPhi(k, IntegrationPoints(g)) *&amp;
<a name="l00493"></a>00493                                                 LinearPhi(m, IntegrationPoints(g)) *&amp;
<a name="l00494"></a>00494                                                 IntegrationWeights(g)
<a name="l00495"></a>00495                 <span class="keyword">end</span> forall
<a name="l00496"></a>00496                 cell = cell * JacobianLength(X, vertex) * this%OuterVector(i,l)
<a name="l00497"></a>00497 <span class="keyword">        end function</span>
<a name="l00498"></a>00498 
<a name="l00499"></a>00499 
<a name="l00506"></a><a class="code" href="class_triangle_element_manipulation.html#ac630f7fcab3523f4fb976c622636747f">00506</a>    <span class="keywordtype">pure</span> <span class="keyword">function </span>MatrixC_i( i, X ) result (C)
<a name="l00507"></a>00507         <span class="keyword">implicit none</span>
<a name="l00508"></a>00508         <span class="keywordtype">integer</span>, <span class="keywordtype">intent(in)</span> :: i
<a name="l00509"></a>00509                 <span class="keywordtype">real(kind=8)</span>, <span class="keywordtype">dimension(nNodes,probDim)</span>, <span class="keywordtype">intent(in)</span> :: X
<a name="l00510"></a>00510 
<a name="l00511"></a>00511         <span class="keywordtype">real(kind=8)</span>, <span class="keywordtype">dimension(nNodes,nNodes)</span> :: C
<a name="l00512"></a>00512 
<a name="l00513"></a>00513         <span class="keywordtype">integer</span>, <span class="keywordtype">dimension(nNodes)</span> :: vertex
<a name="l00514"></a>00514         <span class="keywordtype">integer</span> :: a, b
<a name="l00515"></a>00515 
<a name="l00516"></a>00516         C = 0.0d0
<a name="l00517"></a>00517         vertex = rotation(i)
<a name="l00518"></a>00518                 C(vertex(2),vertex(2)) = 2.0d0
<a name="l00519"></a>00519                 C(vertex(3),vertex(3)) = 2.0d0
<a name="l00520"></a>00520                 C(vertex(2),vertex(3)) = 1.0d0
<a name="l00521"></a>00521                 C(vertex(3),vertex(2)) = 1.0d0
<a name="l00522"></a>00522         C = C * ( &amp;
<a name="l00523"></a>00523                                         (X(vertex(2),1)-X(vertex(3),1))**2.0d0 + &amp;
<a name="l00524"></a>00524                                         (X(vertex(2),2)-X(vertex(3),2))**2.0d0 &amp;
<a name="l00525"></a>00525                                         )**0.5
<a name="l00526"></a>00526 <span class="keyword">    end function</span>
<a name="l00527"></a>00527 
<a name="l00528"></a>00528 
<a name="l00529"></a>00529 
<a name="l00530"></a>00530 
<a name="l00531"></a>00531 <span class="comment">!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!</span>
<a name="l00532"></a>00532 <span class="comment">!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Use on the calculation of the Stiffness Matrix !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!</span>
<a name="l00533"></a>00533 <span class="comment">!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!</span>
<a name="l00534"></a>00534 
<a name="l00540"></a><a class="code" href="class_triangle_element_manipulation.html#a173e3a8fdcf52d64275ad9047e818304">00540</a>         <span class="keywordtype">pure</span> <span class="keyword">function </span>S (X) result (local)
<a name="l00541"></a>00541                 <span class="keyword">implicit none</span>
<a name="l00542"></a>00542                 <span class="keywordtype">real(kind=8)</span>, <span class="keywordtype">dimension(nNodes, probDim)</span>, <span class="keywordtype">intent(in)</span> :: X
<a name="l00543"></a>00543                 <span class="keywordtype">real</span> :: local
<a name="l00544"></a>00544                 local = ( (X(1,1)-X(3,1))*(X(2,2)-X(3,2)) - (X(2,1)-X(3,1))*(X(1,2)-X(3,2)) )/2.0d0
<a name="l00545"></a>00545 <span class="keyword">        end function</span>
<a name="l00546"></a>00546 
<a name="l00547"></a>00547 
<a name="l00553"></a><a class="code" href="class_triangle_element_manipulation.html#a3f66f1675de0d2c3b5b13306ba23db18">00553</a>         <span class="keywordtype">pure</span> <span class="keyword">function </span>Matrix_E(X) result (local)
<a name="l00554"></a>00554                 <span class="keyword">implicit none</span>
<a name="l00555"></a>00555                 <span class="keywordtype">real(kind=8)</span>, <span class="keywordtype">dimension(nNodes,probDim)</span>, <span class="keywordtype">intent(in)</span> :: X
<a name="l00556"></a>00556                 <span class="keywordtype">real(kind=8)</span>, <span class="keywordtype">dimension(nNodes,nNodes)</span> :: local
<a name="l00557"></a>00557                 local = 1.0d0
<a name="l00558"></a>00558                 local(1,1) = 2.0d0; local(2,2) = 2.0d0; local(3,3) = 2.0d0
<a name="l00559"></a>00559                 local = local * S(X)/12.0d0
<a name="l00560"></a>00560 <span class="keyword">        end function</span>
<a name="l00561"></a>00561 
<a name="l00562"></a>00562 
<a name="l00570"></a><a class="code" href="class_triangle_element_manipulation.html#a0c101f6a5e3897ce116e8961586b7a65">00570</a>     <span class="keyword">subroutine </span>SetMatricesE( Matrix, X )
<a name="l00571"></a>00571         <span class="keyword">implicit none</span>
<a name="l00572"></a>00572                 <span class="keywordtype">real(kind=8)</span>, <span class="keywordtype">dimension(MatrixSize,MatrixSize)</span>, <span class="keywordtype">intent(out)</span> :: Matrix
<a name="l00573"></a>00573                 <span class="keywordtype">real(kind=8)</span>, <span class="keywordtype">dimension(nNodes,probDim)</span>, <span class="keywordtype">intent(in)</span> :: X
<a name="l00574"></a>00574 
<a name="l00575"></a>00575                 <span class="keywordtype">integer</span> :: l
<a name="l00576"></a>00576                 <span class="keywordtype">integer</span>, <span class="keywordtype">dimension(nNodes)</span> :: idx
<a name="l00577"></a>00577 
<a name="l00578"></a>00578                 forall(l = 1:probDim)
<a name="l00579"></a>00579                         idx = <a class="code" href="_triangule_element_8f90.html#a93d83cac506f05854405428dc85ba2c1">SetRange</a>(l)
<a name="l00580"></a>00580                         Matrix(idx,idx) = Matrix(idx,idx) + Matrix_E(X)
<a name="l00581"></a>00581                 <span class="keyword">end</span> forall
<a name="l00582"></a>00582         <span class="keyword">contains</span>
<a name="l00583"></a><a class="code" href="_triangule_element_8f90.html#a93d83cac506f05854405428dc85ba2c1">00583</a>                 <span class="keyword">function </span><a class="code" href="_triangule_element_8f90.html#a93d83cac506f05854405428dc85ba2c1">SetRange</a>(base) result (r)
<a name="l00584"></a>00584                         <span class="keyword">implicit none</span>
<a name="l00585"></a>00585                         <span class="keywordtype">integer</span>, <span class="keywordtype">intent(in)</span> :: base
<a name="l00586"></a>00586 
<a name="l00587"></a>00587                         <span class="keywordtype">integer</span>, <span class="keywordtype">dimension(nNodes)</span> :: r
<a name="l00588"></a>00588                         <span class="keywordtype">integer</span> :: i
<a name="l00589"></a>00589 
<a name="l00590"></a>00590                         forall(i=1:nNodes)
<a name="l00591"></a>00591                                 r(i) = nNodes*(l-1)+i+1
<a name="l00592"></a>00592                         <span class="keyword">end</span> forall
<a name="l00593"></a>00593 <span class="keyword">                end function</span>
<a name="l00594"></a>00594 <span class="keyword">    end subroutine</span>
<a name="l00595"></a>00595 
<a name="l00596"></a>00596 
<a name="l00602"></a><a class="code" href="class_triangle_element_manipulation.html#a586bca4be8eb2af770295c4e1fe5c8e5">00602</a>         <span class="keyword">subroutine </span>SetMatricesH_l( this, Matrix, X )
<a name="l00603"></a>00603                 <span class="keyword">implicit none</span>
<a name="l00604"></a>00604                 <span class="keywordtype">type(TriangleElement)</span>, <span class="keywordtype">intent(inout)</span> :: this
<a name="l00605"></a>00605                 <span class="keywordtype">real(kind=8)</span>, <span class="keywordtype">dimension(MatrixSize, MatrixSize)</span>, <span class="keywordtype">intent(out)</span> :: Matrix
<a name="l00606"></a>00606                 <span class="keywordtype">real(kind=8)</span>, <span class="keywordtype">dimension(nNodes,probDim)</span>, <span class="keywordtype">intent(in)</span> :: X
<a name="l00607"></a>00607                 <span class="keywordtype">integer</span> :: l
<a name="l00608"></a>00608 
<a name="l00609"></a>00609                 forall( l = 1:probDim)
<a name="l00610"></a>00610                         Matrix(l:(l*nNodes),Temperature_Initial:Temperature_Final) = Matrix(l:(l*nNodes),Temperature_Initial:Temperature_Final) + MatrixH_l( this, X, l)
<a name="l00611"></a>00611                 <span class="keyword">end</span> forall
<a name="l00612"></a>00612 
<a name="l00613"></a>00613 <span class="keyword">        end subroutine</span>
<a name="l00614"></a>00614 
<a name="l00615"></a>00615 
<a name="l00621"></a><a class="code" href="class_triangle_element_manipulation.html#a86eb931296af45d4a7319dc5bda571c0">00621</a>         <span class="keyword">subroutine </span>SetMatricesJ_l( this, Matrix, X )
<a name="l00622"></a>00622                 <span class="keyword">implicit none</span>
<a name="l00623"></a>00623                 <span class="keywordtype">type(TriangleElement)</span>, <span class="keywordtype">intent(inout)</span> :: this
<a name="l00624"></a>00624                 <span class="keywordtype">real(kind=8)</span>, <span class="keywordtype">dimension(MatrixSize, MatrixSize)</span>, <span class="keywordtype">intent(out)</span> :: Matrix
<a name="l00625"></a>00625                 <span class="keywordtype">real(kind=8)</span>, <span class="keywordtype">dimension(nNodes,probDim)</span>, <span class="keywordtype">intent(in)</span> :: X
<a name="l00626"></a>00626                 <span class="keywordtype">integer</span> :: l
<a name="l00627"></a>00627 
<a name="l00628"></a>00628                 forall( l = 1:probDim)
<a name="l00629"></a>00629                         Matrix(l:(l*nNodes),Temperature_Initial:Temperature_Final) = Matrix(l:(l*nNodes),Temperature_Initial:Temperature_Final) + MatrixH_l( this, X, l)
<a name="l00630"></a>00630                 <span class="keyword">end</span> forall
<a name="l00631"></a>00631 
<a name="l00632"></a>00632 <span class="keyword">        end subroutine</span>
<a name="l00633"></a>00633 
<a name="l00634"></a>00634 
<a name="l00635"></a>00635         <span class="comment">!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!Face components of the Stiffness Matrix!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!</span>
<a name="l00636"></a>00636 
<a name="l00645"></a><a class="code" href="class_triangle_element_manipulation.html#a53e88b694fc36f2bd211600c5ac03fd8">00645</a>     <span class="keyword">subroutine </span>SetMatricesE_lr_i( this, Matrix, X, ThermCond, Stabilization )
<a name="l00646"></a>00646         <span class="keyword">implicit none</span>
<a name="l00647"></a>00647                 <span class="keywordtype">integer</span>, <span class="keywordtype">parameter</span> :: nInterpolationPoints = nNodes
<a name="l00648"></a>00648                 <span class="keywordtype">integer</span>, <span class="keywordtype">parameter</span> :: nDimension = probDim
<a name="l00649"></a>00649         <span class="keywordtype">integer</span>, <span class="keywordtype">parameter</span> :: nSides = 3
<a name="l00650"></a>00650         <span class="keywordtype">type(TriangleElement)</span>, <span class="keywordtype">intent(inout)</span> :: this
<a name="l00651"></a>00651         <span class="keywordtype">real(kind=8)</span>, <span class="keywordtype">dimension(MatrixSize,MatrixSize+1)</span>, <span class="keywordtype">intent(inout)</span> :: Matrix
<a name="l00652"></a>00652         <span class="keywordtype">real(kind=8)</span>, <span class="keywordtype">dimension(nNodes,2)</span>, <span class="keywordtype">intent(in)</span> :: X <span class="comment">!&lt; Planar Element</span>
<a name="l00653"></a>00653         <span class="keyword">interface</span>
<a name="l00654"></a>00654                         <span class="keywordtype">pure</span> <span class="keyword">function </span>ThermCond(T) result (v) !&lt; Thermal Conductivity Function
<a name="l00655"></a>00655                                 <span class="keyword">implicit none</span>
<a name="l00656"></a>00656                                 <span class="keywordtype">real(kind=8)</span>, <span class="keywordtype">intent(in)</span> :: T
<a name="l00657"></a>00657                                 <span class="keywordtype">real(kind=8)</span> :: v
<a name="l00658"></a>00658 <span class="keyword">                        end function</span>
<a name="l00659"></a>00659 <span class="keyword">                end interface</span>
<a name="l00660"></a>00660                 <span class="keywordtype">real(kind=8)</span>, <span class="keywordtype">intent(in)</span> :: Stabilization
<a name="l00661"></a>00661 
<a name="l00662"></a>00662                 <span class="keywordtype">integer</span> :: l, r  <span class="comment">!&lt; l, r = x, y, z (1, 2, 3)</span>
<a name="l00663"></a>00663         <span class="keywordtype">integer</span> :: i <span class="comment">!&lt; side index</span>
<a name="l00664"></a>00664         <span class="keywordtype">integer</span> :: k, m <span class="comment">!&lt; local base index</span>
<a name="l00665"></a>00665                 <span class="keywordtype">integer</span> :: l_m, r_m  <span class="comment">!&lt; local matrix real position</span>
<a name="l00666"></a>00666 
<a name="l00667"></a>00667         forall(i = 1:nSides)  <span class="comment">!&lt; Warp through  Triangle1&#39;s Sides</span>
<a name="l00668"></a>00668                         forall (l=1:nDimension) <span class="comment">!&lt; Warp through Local dimensions</span>
<a name="l00669"></a>00669                                 forall (r=1:nDimension) <span class="comment">!&lt; Warp through Local dimensions</span>
<a name="l00670"></a>00670                                         forall (k=1:nInterpolationPoints) <span class="comment">!&lt; Warp through  local basis</span>
<a name="l00671"></a>00671                                                 forall (m=1:nInterpolationPoints) <span class="comment">!&lt; Warp throug local basis</span>
<a name="l00672"></a>00672                                                         l_m = (l-1)*nNodes+k  <span class="comment">!&lt; Matrix Index of Element Matrix</span>
<a name="l00673"></a>00673                                                         r_m = (r-1)*nNodes+m  <span class="comment">!&lt; Matrix Index of Element Matrix</span>
<a name="l00674"></a>00674                                                         Matrix(l_m, r_m) = Matrix(l_m, r_m) + &amp;
<a name="l00675"></a>00675                                                                         MatrixE_lr_i_km(this, l, r, i, k, m, X, ThermCond, Stabilization) *&amp;
<a name="l00676"></a>00676                                                                         Stabilization
<a name="l00677"></a>00677                                                 <span class="keyword">end</span> forall
<a name="l00678"></a>00678                                         <span class="keyword">end</span> forall
<a name="l00679"></a>00679                                 <span class="keyword">end</span> forall
<a name="l00680"></a>00680                         <span class="keyword">end</span> forall
<a name="l00681"></a>00681         <span class="keyword">end</span> forall
<a name="l00682"></a>00682 <span class="keyword">    end subroutine</span>
<a name="l00683"></a>00683 
<a name="l00684"></a>00684 
<a name="l00693"></a>00693         <span class="keyword">subroutine </span>SetMatricesH_l_i( this, Matrix, X, ThermCond, Stabilization )
<a name="l00694"></a>00694         <span class="keyword">implicit none</span>
<a name="l00695"></a>00695                 <span class="keywordtype">integer</span>, <span class="keywordtype">parameter</span> :: nInterpolationPoints = nNodes
<a name="l00696"></a>00696                 <span class="keywordtype">integer</span>, <span class="keywordtype">parameter</span> :: nDimension = probDim
<a name="l00697"></a>00697         <span class="keywordtype">integer</span>, <span class="keywordtype">parameter</span> :: nSides = 3
<a name="l00698"></a>00698         <span class="keywordtype">type(TriangleElement)</span>, <span class="keywordtype">intent(inout)</span> :: this
<a name="l00699"></a>00699         <span class="keywordtype">real(kind=8)</span>, <span class="keywordtype">dimension(MatrixSize, MatrixSize+1)</span>, <span class="keywordtype">intent(inout)</span> :: Matrix
<a name="l00700"></a>00700         <span class="keywordtype">real(kind=8)</span>, <span class="keywordtype">dimension(nNodes,2)</span>, <span class="keywordtype">intent(in)</span> :: X <span class="comment">!&lt; Planar Element</span>
<a name="l00701"></a>00701         <span class="keyword">interface</span>
<a name="l00702"></a>00702                         <span class="keywordtype">pure</span> <span class="keyword">function </span>ThermCond(T) result (v) !&lt; Thermal Conductivity Function
<a name="l00703"></a>00703                                 <span class="keyword">implicit none</span>
<a name="l00704"></a>00704                                 <span class="keywordtype">real(kind=8)</span>, <span class="keywordtype">intent(in)</span> :: T
<a name="l00705"></a>00705                                 <span class="keywordtype">real(kind=8)</span> :: v
<a name="l00706"></a>00706 <span class="keyword">                        end function</span>
<a name="l00707"></a>00707 <span class="keyword">                end interface</span>
<a name="l00708"></a>00708         <span class="keywordtype">real(kind=8)</span>, <span class="keywordtype">intent(in)</span> :: Stabilization
<a name="l00709"></a>00709 
<a name="l00710"></a>00710                 <span class="keywordtype">integer</span> :: l_m, r_m
<a name="l00711"></a>00711                 <span class="keywordtype">integer</span> :: i
<a name="l00712"></a>00712                 <span class="keywordtype">integer</span> :: l, r
<a name="l00713"></a>00713                 <span class="keywordtype">integer</span> :: k, m
<a name="l00714"></a>00714 
<a name="l00715"></a>00715                 forall(i = 1:nSides)
<a name="l00716"></a>00716                         forall(l=1:nDimension)
<a name="l00717"></a>00717                                 forall(r=1:nDimension)
<a name="l00718"></a>00718                                         forall(k=1:nInterpolationPoints)
<a name="l00719"></a>00719                                                 forall(m=1:nInterpolationPoints)
<a name="l00720"></a>00720                                                         l_m = (l-1)*nNodes+k
<a name="l00721"></a>00721                                                         r_m = (r-1)*nNodes+m
<a name="l00722"></a>00722                                                         Matrix(l_m, r_m) = Matrix(l_m, r_m) + ( -(0.5d0 + Stabilization)) * &amp;
<a name="l00723"></a>00723                                                                         MatrixH_l_i_km(this, l, i, k, m, X, ThermCond)
<a name="l00724"></a>00724                                                 <span class="keyword">end</span> forall
<a name="l00725"></a>00725                                         <span class="keyword">end</span> forall
<a name="l00726"></a>00726                                 <span class="keyword">end</span> forall
<a name="l00727"></a>00727                         <span class="keyword">end</span> forall
<a name="l00728"></a>00728                 <span class="keyword">end</span> forall
<a name="l00729"></a>00729 <span class="keyword">        end subroutine</span>
<a name="l00730"></a>00730 
<a name="l00731"></a>00731 
<a name="l00739"></a>00739         <span class="keyword">subroutine </span>SetMatricesJ_l_i( this, Matrix, X, Stabilization )
<a name="l00740"></a>00740         <span class="keyword">implicit none</span>
<a name="l00741"></a>00741                 <span class="keywordtype">integer</span>, <span class="keywordtype">parameter</span> :: nInterpolationPoints = nNodes
<a name="l00742"></a>00742                 <span class="keywordtype">integer</span>, <span class="keywordtype">parameter</span> :: nDimension = probDim
<a name="l00743"></a>00743         <span class="keywordtype">integer</span>, <span class="keywordtype">parameter</span> :: nSides = 3
<a name="l00744"></a>00744         <span class="keywordtype">type(TriangleElement)</span>, <span class="keywordtype">intent(inout)</span> :: this
<a name="l00745"></a>00745         <span class="keywordtype">real(kind=8)</span>, <span class="keywordtype">dimension(MatrixSize, MatrixSize+1)</span>, <span class="keywordtype">intent(inout)</span> :: Matrix
<a name="l00746"></a>00746         <span class="keywordtype">real(kind=8)</span>, <span class="keywordtype">dimension(nNodes,2)</span>, <span class="keywordtype">intent(in)</span> :: X <span class="comment">!&lt; Planar Element</span>
<a name="l00747"></a>00747         <span class="keywordtype">real(kind=8)</span>, <span class="keywordtype">intent(in)</span> :: Stabilization
<a name="l00748"></a>00748 
<a name="l00749"></a>00749                 <span class="keywordtype">integer</span> :: l_m, r_m
<a name="l00750"></a>00750                 <span class="keywordtype">integer</span> :: i
<a name="l00751"></a>00751                 <span class="keywordtype">integer</span> :: l, r
<a name="l00752"></a>00752                 <span class="keywordtype">integer</span> :: k, m
<a name="l00753"></a>00753 
<a name="l00754"></a>00754                 forall(i = 1:nSides)
<a name="l00755"></a>00755                         forall(l=1:nDimension)
<a name="l00756"></a>00756                                 forall(r=1:nDimension)
<a name="l00757"></a>00757                                         forall(k=1:nInterpolationPoints)
<a name="l00758"></a>00758                                                 forall(m=1:nInterpolationPoints)
<a name="l00759"></a>00759                                                         l_m = (l-1)*nNodes+k
<a name="l00760"></a>00760                                                         r_m = (r-1)*nNodes+m
<a name="l00761"></a>00761                                                         Matrix(l_m, r_m) = Matrix(l_m, r_m) + ( -(0.5d0 - Stabilization)) * &amp;
<a name="l00762"></a>00762                                                                         MatrixJ_l_i_km(this, l, i, k, m, X, Stabilization)
<a name="l00763"></a>00763                                                 <span class="keyword">end</span> forall
<a name="l00764"></a>00764                                         <span class="keyword">end</span> forall
<a name="l00765"></a>00765                                 <span class="keyword">end</span> forall
<a name="l00766"></a>00766                         <span class="keyword">end</span> forall
<a name="l00767"></a>00767                 <span class="keyword">end</span> forall
<a name="l00768"></a>00768 <span class="keyword">        end subroutine</span>
<a name="l00769"></a>00769 
<a name="l00770"></a>00770 
<a name="l00777"></a>00777     <span class="keyword">subroutine </span>SetMatrixG_T_i( Matrix, X, Stabilization )
<a name="l00778"></a>00778         <span class="keyword">implicit none</span>
<a name="l00779"></a>00779         <span class="keywordtype">integer</span>, <span class="keywordtype">parameter</span> :: nSides = nNodes
<a name="l00780"></a>00780                 <span class="keywordtype">real(kind=8)</span>, <span class="keywordtype">dimension(MatrixSize,MatrixSize)</span>, <span class="keywordtype">intent(out)</span> :: Matrix
<a name="l00781"></a>00781                 <span class="keywordtype">real(kind=8)</span>, <span class="keywordtype">dimension(nNodes,probDim)</span>, <span class="keywordtype">intent(in)</span> :: X
<a name="l00782"></a>00782 
<a name="l00783"></a>00783                 <span class="keywordtype">integer</span> :: l
<a name="l00784"></a>00784 
<a name="l00785"></a>00785                 forall(l = 1:nSides)
<a name="l00786"></a>00786                         Matrix(idx,idx) = Matrix + Stabilization * MatrixC_i(l, X)
<a name="l00787"></a>00787                 <span class="keyword">end</span> forall
<a name="l00788"></a>00788 <span class="keyword">    end subroutine</span>
<a name="l00789"></a>00789 
<a name="l00790"></a>00790 
<a name="l00791"></a>00791 <span class="comment">!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!</span>
<a name="l00792"></a>00792 <span class="comment">!!!!!!!!!!!!!!!!!!!!!!!!!! Use on the calculations of the Neighbour dominated vector of the Element !!!!!!!!!!!!!!!!!!!!!!!!!</span>
<a name="l00793"></a>00793 <span class="comment">!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!</span>
<a name="l00794"></a>00794 
<a name="l00795"></a>00795 
<a name="l00796"></a>00796 
<a name="l00806"></a>00806     <span class="keyword">subroutine </span>SetMatricesE_lr_B_i( this, Vector, Neighbours, X, ThermCond, Stabilization )
<a name="l00807"></a>00807         <span class="keyword">implicit none</span>
<a name="l00808"></a>00808                 <span class="keywordtype">integer</span>, <span class="keywordtype">parameter</span> :: nInterpolationPoints = nNodes
<a name="l00809"></a>00809                 <span class="keywordtype">integer</span>, <span class="keywordtype">parameter</span> :: nDimension = probDim
<a name="l00810"></a>00810         <span class="keywordtype">integer</span>, <span class="keywordtype">parameter</span> :: nSides = 3
<a name="l00811"></a>00811         <span class="keywordtype">type(TriangleElement)</span>, <span class="keywordtype">intent(inout)</span> :: this
<a name="l00812"></a>00812         <span class="keywordtype">real(kind=8)</span>, <span class="keywordtype">dimension(MatrixSize)</span>, <span class="keywordtype">intent(inout)</span> :: Vector
<a name="l00813"></a>00813         <span class="keywordtype">type(TriangleElement)</span>, <span class="keywordtype">dimension(nSides)</span>, <span class="keywordtype">intent(in)</span> :: Neighbours
<a name="l00814"></a>00814         <span class="keywordtype">real(kind=8)</span>, <span class="keywordtype">dimension(nNodes,2)</span>, <span class="keywordtype">intent(in)</span> :: X <span class="comment">!&lt; Planar Element</span>
<a name="l00815"></a>00815         <span class="keyword">interface</span>
<a name="l00816"></a>00816                         <span class="keywordtype">pure</span> <span class="keyword">function </span>ThermCond(T) result (v) !&lt; Thermal Conductivity Function
<a name="l00817"></a>00817                                 <span class="keyword">implicit none</span>
<a name="l00818"></a>00818                                 <span class="keywordtype">real(kind=8)</span>, <span class="keywordtype">intent(in)</span> :: T
<a name="l00819"></a>00819                                 <span class="keywordtype">real(kind=8)</span> :: v
<a name="l00820"></a>00820 <span class="keyword">                        end function</span>
<a name="l00821"></a>00821 <span class="keyword">                end interface</span>
<a name="l00822"></a>00822                 <span class="keywordtype">real(kind=8)</span>, <span class="keywordtype">intent(in)</span> :: Stabilization
<a name="l00823"></a>00823 
<a name="l00824"></a>00824                 <span class="keywordtype">integer</span> :: l, r  <span class="comment">!&lt; l, r = x, y, z (1, 2, 3)</span>
<a name="l00825"></a>00825         <span class="keywordtype">integer</span> :: i <span class="comment">!&lt; side index</span>
<a name="l00826"></a>00826         <span class="keywordtype">integer</span> :: k, m <span class="comment">!&lt; local base index</span>
<a name="l00827"></a>00827                 <span class="keywordtype">integer</span> :: l_m, r_m  <span class="comment">!&lt; local matrix real position</span>
<a name="l00828"></a>00828 
<a name="l00829"></a>00829         forall(i = 1:nSides)  <span class="comment">!&lt; Warp through  Triangle1&#39;s Sides</span>
<a name="l00830"></a>00830                         forall (l=1:nDimension) <span class="comment">!&lt; Warp through Local dimensions</span>
<a name="l00831"></a>00831                                 forall (r=1:nDimension) <span class="comment">!&lt; Warp through Local dimensions</span>
<a name="l00832"></a>00832                                         forall (k=1:nInterpolationPoints) <span class="comment">!&lt; Warp through  local basis</span>
<a name="l00833"></a>00833                                                 forall (m=1:nInterpolationPoints) <span class="comment">!&lt; Warp throug local basis</span>
<a name="l00834"></a>00834                                                         l_m = (l-1)*nNodes+k  <span class="comment">!&lt; Matrix Index of Element Matrix</span>
<a name="l00835"></a>00835                                                         r_m = (r-1)*nNodes+m  <span class="comment">!&lt; Matrix Index of Element Matrix</span>
<a name="l00836"></a>00836                                                         Vector(l_m) = Vector(l_m) - &amp;
<a name="l00837"></a>00837                                                                         MatrixE_lr_i_km(this, l, r, i, k, m, X, ThermCond, Stabilization) *&amp;
<a name="l00838"></a>00838                                                                         Stabilization * Neighbours(i)%DoF(r_m, Dof_Commit) * (-1.0d0) <span class="comment">! -1 is due the change on the equality sign</span>
<a name="l00839"></a>00839                                                 <span class="keyword">end</span> forall
<a name="l00840"></a>00840                                         <span class="keyword">end</span> forall
<a name="l00841"></a>00841                                 <span class="keyword">end</span> forall
<a name="l00842"></a>00842                         <span class="keyword">end</span> forall
<a name="l00843"></a>00843         <span class="keyword">end</span> forall
<a name="l00844"></a>00844 <span class="keyword">    end subroutine</span>
<a name="l00845"></a>00845 
<a name="l00846"></a>00846 
<a name="l00856"></a><a class="code" href="class_triangle_element_manipulation.html#a50b3ef9cd62514ddc19822d0a23cf0c1">00856</a>         <span class="keyword">subroutine </span>SetMatricesH_l_B_i( this, Vector, Neighbours, X, Stabilization, ThermCond )
<a name="l00857"></a>00857         <span class="keyword">implicit none</span>
<a name="l00858"></a>00858                 <span class="keywordtype">integer</span>, <span class="keywordtype">parameter</span> :: nInterpolationPoints = nNodes
<a name="l00859"></a>00859                 <span class="keywordtype">integer</span>, <span class="keywordtype">parameter</span> :: nDimension = probDim
<a name="l00860"></a>00860         <span class="keywordtype">integer</span>, <span class="keywordtype">parameter</span> :: nSides = 3
<a name="l00861"></a>00861         <span class="keywordtype">type(TriangleElement)</span>, <span class="keywordtype">intent(inout)</span> :: this
<a name="l00862"></a>00862         <span class="keywordtype">real(kind=8)</span>, <span class="keywordtype">dimension(MatrixSize)</span>, <span class="keywordtype">intent(inout)</span> :: Vector
<a name="l00863"></a>00863         <span class="keywordtype">type(TriangleElement)</span>, <span class="keywordtype">dimension(nSides)</span>, <span class="keywordtype">intent(in)</span> :: Neighbours
<a name="l00864"></a>00864         <span class="keywordtype">real(kind=8)</span>, <span class="keywordtype">dimension(nNodes,2)</span>, <span class="keywordtype">intent(in)</span> :: X <span class="comment">!&lt; Planar Element</span>
<a name="l00865"></a>00865         <span class="keywordtype">real(kind=8)</span>, <span class="keywordtype">intent(in)</span> :: Stabilization
<a name="l00866"></a>00866         <span class="keyword">interface</span>
<a name="l00867"></a>00867                         <span class="keywordtype">pure</span> <span class="keyword">function </span>ThermCond(T) result (v) !&lt; Thermal Conductivity Function
<a name="l00868"></a>00868                                 <span class="keyword">implicit none</span>
<a name="l00869"></a>00869                                 <span class="keywordtype">real(kind=8)</span>, <span class="keywordtype">intent(in)</span> :: T
<a name="l00870"></a>00870                                 <span class="keywordtype">real(kind=8)</span> :: v
<a name="l00871"></a>00871 <span class="keyword">                        end function</span>
<a name="l00872"></a>00872 <span class="keyword">                end interface</span>
<a name="l00873"></a>00873 
<a name="l00874"></a>00874                 <span class="keywordtype">integer</span> :: l_m, r_m
<a name="l00875"></a>00875                 <span class="keywordtype">integer</span> :: i
<a name="l00876"></a>00876                 <span class="keywordtype">integer</span> :: l, r
<a name="l00877"></a>00877                 <span class="keywordtype">integer</span> :: k, m
<a name="l00878"></a>00878 
<a name="l00879"></a>00879                 forall(i = 1:nSides)
<a name="l00880"></a>00880                         forall(l=1:nDimension)
<a name="l00881"></a>00881                                 forall(r=1:nDimension)
<a name="l00882"></a>00882                                         forall(k=1:nInterpolationPoints)
<a name="l00883"></a>00883                                                 forall(m=1:nInterpolationPoints)
<a name="l00884"></a>00884                                                         l_m = (l-1)*nNodes+k
<a name="l00885"></a>00885                                                         r_m = (r-1)*nNodes+m
<a name="l00886"></a>00886                                                         Vector(l_m) = Matrix(l_m, r_m) + ( -(0.5d0 - Stabilization)) * &amp;
<a name="l00887"></a>00887                                                                         MatrixH_l_i_km(this, l, i, k, m, X, ThermCond) * &amp;
<a name="l00888"></a>00888                                                                         Neighbours(i)%DoF(r_m, Dof_Committ) * (-1.0d0) <span class="comment">! -1 is due the change on the equality sign</span>
<a name="l00889"></a>00889                                                 <span class="keyword">end</span> forall
<a name="l00890"></a>00890                                         <span class="keyword">end</span> forall
<a name="l00891"></a>00891                                 <span class="keyword">end</span> forall
<a name="l00892"></a>00892                         <span class="keyword">end</span> forall
<a name="l00893"></a>00893                 <span class="keyword">end</span> forall
<a name="l00894"></a>00894 <span class="keyword">        end subroutine</span>
<a name="l00895"></a>00895 
<a name="l00896"></a>00896 
<a name="l00905"></a><a class="code" href="class_triangle_element_manipulation.html#a27fefeca56fced4aa525bf980feb5659">00905</a>         <span class="keyword">subroutine </span>SetMatricesJ_l_B_i( this, Vector, Neighbours, X, Stabilization )
<a name="l00906"></a>00906         <span class="keyword">implicit none</span>
<a name="l00907"></a>00907                 <span class="keywordtype">integer</span>, <span class="keywordtype">parameter</span> :: nInterpolationPoints = nNodes
<a name="l00908"></a>00908                 <span class="keywordtype">integer</span>, <span class="keywordtype">parameter</span> :: nDimension = probDim
<a name="l00909"></a>00909         <span class="keywordtype">integer</span>, <span class="keywordtype">parameter</span> :: nSides = 3
<a name="l00910"></a>00910         <span class="keywordtype">type(TriangleElement)</span>, <span class="keywordtype">intent(inout)</span> :: this
<a name="l00911"></a>00911         <span class="keywordtype">real(kind=8)</span>, <span class="keywordtype">dimension(MatrixSize)</span>, <span class="keywordtype">intent(inout)</span> :: Vector
<a name="l00912"></a>00912         <span class="keywordtype">type(TriangleElement)</span>, <span class="keywordtype">dimension(nSides)</span>, <span class="keywordtype">intent(in)</span> :: Neighbours
<a name="l00913"></a>00913         <span class="keywordtype">real(kind=8)</span>, <span class="keywordtype">dimension(nNodes,2)</span>, <span class="keywordtype">intent(in)</span> :: X <span class="comment">!&lt; Planar Element</span>
<a name="l00914"></a>00914         <span class="keywordtype">real(kind=8)</span>, <span class="keywordtype">intent(in)</span> :: Stabilization
<a name="l00915"></a>00915 
<a name="l00916"></a>00916                 <span class="keywordtype">integer</span> :: l_m, r_m
<a name="l00917"></a>00917                 <span class="keywordtype">integer</span> :: i
<a name="l00918"></a>00918                 <span class="keywordtype">integer</span> :: l, r
<a name="l00919"></a>00919                 <span class="keywordtype">integer</span> :: k, m
<a name="l00920"></a>00920 
<a name="l00921"></a>00921                 forall(i = 1:nSides)
<a name="l00922"></a>00922                         forall(l=1:nDimension)
<a name="l00923"></a>00923                                 forall(r=1:nDimension)
<a name="l00924"></a>00924                                         forall(k=1:nInterpolationPoints)
<a name="l00925"></a>00925                                                 forall(m=1:nInterpolationPoints)
<a name="l00926"></a>00926                                                         l_m = (l-1)*nNodes+k
<a name="l00927"></a>00927                                                         r_m = (r-1)*nNodes+m
<a name="l00928"></a>00928                                                         Vector(l_m) = Vector(l_m) + ( -(0.5d0 + Stabilization)) * &amp;
<a name="l00929"></a>00929                                                                         MatrixJ_l_i_km(this, l, i, k, m, X) * &amp;
<a name="l00930"></a>00930                                                                         Neighbours(i)%DoF(r_m, Dof_Committ) * (-1.0d0) <span class="comment">! -1 is due the change on the equality sign</span>
<a name="l00931"></a>00931                                                 <span class="keyword">end</span> forall
<a name="l00932"></a>00932                                         <span class="keyword">end</span> forall
<a name="l00933"></a>00933                                 <span class="keyword">end</span> forall
<a name="l00934"></a>00934                         <span class="keyword">end</span> forall
<a name="l00935"></a>00935                 <span class="keyword">end</span> forall
<a name="l00936"></a>00936 <span class="keyword">        end subroutine</span>
<a name="l00937"></a>00937 
<a name="l00938"></a>00938 
<a name="l00946"></a><a class="code" href="class_triangle_element_manipulation.html#a67894321bcfc0e9b8afaf83113f1160e">00946</a>     <span class="keyword">subroutine </span>SetMatrixG_T_B_i( Vector, Neighbours, X, Stabilization )
<a name="l00947"></a>00947         <span class="keyword">implicit none</span>
<a name="l00948"></a>00948         <span class="keywordtype">real(kind=8)</span>, <span class="keywordtype">dimension(MatrixSize)</span>, <span class="keywordtype">intent(inout)</span> :: Vector
<a name="l00949"></a>00949         <span class="keywordtype">type(TriangleElement)</span>, <span class="keywordtype">dimension(nSides)</span>, <span class="keywordtype">intent(in)</span> :: Neighbours
<a name="l00950"></a>00950                 <span class="keywordtype">real(kind=8)</span>, <span class="keywordtype">dimension(nNodes,probDim)</span>, <span class="keywordtype">intent(in)</span> :: X
<a name="l00951"></a>00951 
<a name="l00952"></a>00952                 <span class="keywordtype">integer</span> :: l
<a name="l00953"></a>00953 
<a name="l00954"></a>00954                 forall(l = 1:nSides)
<a name="l00955"></a>00955                         Matrix(idx,idx) = Matrix - Stabilization * MatrixC_i(l, X) * &amp;
<a name="l00956"></a>00956                                                                         Neighbours(i)%DoF(r_m, Dof_Committ) * (-1.0d0) <span class="comment">! -1 is due the change on the equality sign</span>
<a name="l00957"></a>00957                 <span class="keyword">end</span> forall
<a name="l00958"></a>00958 <span class="keyword">    end subroutine</span>
<a name="l00959"></a>00959 
<a name="l00960"></a>00960 
<a name="l00961"></a>00961 <span class="keyword">end module</span>
<a name="l00962"></a>00962 </pre></div></div>
</div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Variables</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>



<hr class="footer"/><address class="footer"><small>
Generated on Wed May 23 2012 11:59:07 for DiscontinuousGalerkin by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.7.5.1
</small></address>

</body>
</html>
